import request from '@/utils/request';
import moment from 'moment';

const defaultHeaders = {
  'Authorization': 'Bearer app-J8oB2k4mNSwFGmOQalJQD8Oq',
  'Content-Type': 'application/json',
  'Accept': 'application/json'
};
// 发送消息
export const sendChatMessage = ( data: any, customHeaders?: any) => {
  return request({
    url: `/chat-messages`,
    method: 'post',
    data: {
      ...data
    },
    headers: {
      ...defaultHeaders,
      ...customHeaders
    }
  });
};
// 获取消息
export const getConversationMessages = (params: string, customHeaders?: any) => {
  console.log("params",params)
  return request({
    url: `/messages`,
    method: 'get',
    params,
    headers: {
      ...defaultHeaders,
      ...customHeaders
    }
  });
};

export const createConversation = (customHeaders?: any) => {
  return request({
    url: `/conversation`,
    method: 'post',
    headers: {
      ...defaultHeaders,
      ...customHeaders
    }
  });
};

export const getQuizClassification = (params: any, customHeaders?: any) => {
  return request({
    url: `/quiz/classification`,
    method: 'get',
    params,
    headers: {
      ...defaultHeaders,
      ...customHeaders
    }
  });
};

export const getQuizError = (params: any, customHeaders?: any) => {
  return request({
    url: `/quiz/error`,
    method: 'get',
    params,
    headers: {
      ...defaultHeaders,
      ...customHeaders
    }
  });
};

export const calculateFileRAG = (params: any, customHeaders?: any) => {
  return request({
    url: `/quiz/file-rag`,
    method: 'get',
    params,
    headers: {
      ...defaultHeaders,
      ...customHeaders
    }
  });
};

